//
// Game Animation.
// Copyright (C) 2007 Department of Computer Science, University of Copenhagen
//
#include <animation/configuration.h>

#define DEFINE_GLUT_MAIN
#include <OpenTissue/utility/glut/glut_perspective_view_application.h>
#undef DEFINE_GLUT_MAIN

#include <OpenTissue/utility/gl/gl_util.h>
#include <OpenTissue/gpu//cg/cg_util.h>
#include <animation/game_animation_types.h>
#include <animation/streamscape/streamscape.h>

class Application : public OpenTissue::glut::PerspectiveViewApplication
{
public:

  typedef animation::GameAnimationTypes< OpenTissue::math::BasicMathTypes<float, size_t>  >   types;
  typedef types::real_type              real_type;
  typedef types::vector3_type           vector3_type;
  typedef types::quaternion_type        quaternion_type;
  typedef types::matrix3x3_type         matrix3x3_type;

protected:

  animation::StreamScape<types> m_streamscape;  

public:

  Application()
  {
    //--- This is how one could change the default size of the main window
    this->width() = 512;
    this->height() = 512;
  }

public:

  char const * do_get_title() const { return "Game Animation StreamScape Demo Application"; }

  void do_display()
  {
  m_streamscape.render();
  }

  void do_action(unsigned char choice){}

  void do_init_right_click_menu(int main_menu, void menu(int entry)){}

  void do_init()
  {
    OpenTissue::cg::startup();

    math_types::vector3_type position( 0, -10, 10);
    math_types::vector3_type target(0,0,0);
    math_types::vector3_type up(0,0,1);

    this->camera().init(position, target, up);
  }

  void do_run(){}

  void do_shutdown()
  {
    OpenTissue::cg::shutdown();
  }

};

OpenTissue::glut::instance_pointer init_glut_application(int argc, char **argv)
{
  OpenTissue::glut::instance_pointer instance;
  instance.reset( new Application() );
  return instance;
}
